memset(l2tab, 0, DOMAIN_ENTRIES_PER_L2_PAGETABLE*sizeof(l2_pgentry_t));
p->mm.pagetable = mk_pagetable(phys_l2tab);
- /* Domain 0 gets WRITE access to the read-only machine->physical table. */
- mk_l2_writeable(l2tab + (READONLY_MPT_VIRT_START >> L2_PAGETABLE_SHIFT));
-
/*
* NB. The upper limit on this loop does one extra page + pages for frame
* table. This is to make sure a pte exists when we want to map the
DOMAIN_ENTRIES_PER_L2_PAGETABLE] =
mk_l2_pgentry(__pa(current->mm.perdomain_pt) | __PAGE_HYPERVISOR);
- /*
- * DOM0 has the MPT mapped as WRITABLE.
- * 'p_l2_entry' happens to be pointing at the right place at this point :-)
- */
- if ( current->domain == 0 ) mk_l2_writeable(p_l2_entry);
-
out:
unmap_domain_mem(p_l2_entry);
return ret;
return err;
}
-/* functions to handle page table updates: upper half is invoked in case pt updates
- * are requested by a domain and it invokes copy_from_user. bottom half is invoked
- * both in case of domain downcall and domain building by hypervisor.
+/*
+ * functions to handle page table updates: upper half is invoked in case pt
+ * updates are requested by a domain and it invokes copy_from_user. bottom half
+ * is invoked both in case of domain downcall and domain building by
+ * hypervisor.
*/
page_update_request_t * do_process_page_updates_uh(page_update_request_t *updates,
int count)
/* Least significant bits of 'ptr' demux the operation type. */
switch ( cur->ptr & (sizeof(l1_pgentry_t)-1) )
{
-
/*
* PGREQ_NORMAL: Normal update to any level of page table.
*/
break;
}
}
+ break;
+ case PGREQ_MPT_UPDATE:
+ page = frame_table + pfn;
+ if ( DOMAIN_OKAY(page->flags) )
+ {
+ machine_to_phys_mapping[pfn] = cur->val;
+ }
break;
/*
*/
/* A normal page-table update request. */
#define PGREQ_NORMAL 0
-/* Make an unchecked update to a base-level pte. */
-#define PGREQ_UNCHECKED_UPDATE 1
+/* Update an entry in the machine->physical mapping table. */
+#define PGREQ_MPT_UPDATE 1
/* An extended command. */
#define PGREQ_EXTENDED_COMMAND 2
unsigned long ptr, val; /* *ptr = val */
#define PGEXT_NEW_BASEPTR 5
#define PGEXT_TLB_FLUSH 6
#define PGEXT_INVLPG 7
+#define PGEXT_
#define PGEXT_CMD_MASK 255
#define PGEXT_CMD_SHIFT 8
} page_update_request_t;
extern unsigned long max_page;
void init_frametable(unsigned long nr_pages);
+/*
+ * The MPT (machine->physical mapping table) is an array of word-sized
+ * values, indexed on machine frame number. It is expected that guest OSes
+ * will use it to store a "physical" frame number to give the appearance of
+ * contiguous (or near contiguous) physical memory.
+ */
+#define machine_to_phys_mapping ((unsigned long *)RDWR_MPT_VIRT_START)
+
/* Part of the domain API. */
int do_process_page_updates(page_update_request_t *updates, int count);